﻿using System;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using OmegaEngine;

namespace OmegaEngine
{
    /// <summary>GUIBackground is a GUI element that is displayed as an image.</summary>
    /// <remarks>Simply pass a texture loaded from Engine.Cotent.Load as well as the other
    /// optional arguments to use.</remarks>
    public class GUIBackground : GUIActor
    {
        Texture2D texture { get; set; }
        Color color = Color.White;

        public GUIBackground(Texture2D Texture)
            : base(Texture.Width, Texture.Height)
        {
            SetupTexture(Texture, Color.White);
        }

        public GUIBackground(Texture2D Texture, GameScreen Parent)
            : base(Texture.Width, Texture.Height, Parent)
        {
            SetupTexture(Texture, Color.White);
        }

        public GUIBackground(Texture2D Texture, int PositionX, int PositionY)
            : base(Texture.Width, Texture.Height, PositionX, PositionY)
        {
            SetupTexture(Texture, Color.White);
        }

        public GUIBackground(Texture2D Texture, int PositionX, int PositionY, GameScreen Parent)
            : base(Texture.Width, Texture.Height, PositionX, PositionY, Parent)
        {
            SetupTexture(Texture, Color.White);
        }

        public GUIBackground(Texture2D Texture, int PositionX, int PositionY, Color Color)
            : base(Texture.Width, Texture.Height, PositionX, PositionY)
        {
            SetupTexture(Texture, Color);
        }

        public GUIBackground(Texture2D Texture, int PositionX, int PositionY, Color Color, GameScreen Parent)
            : base(Texture.Width, Texture.Height, PositionX, PositionY, Parent)
        {
            SetupTexture(Texture, Color);
        }

        public GUIBackground(Texture2D Texture, int PositionX, int PositionY, int Width, int Height, Color Color)
            : base(Width, Height, PositionX, PositionY)
        {
            SetupTexture(Texture, Color);
        }

        public GUIBackground(Texture2D Texture, int PositionX, int PositionY, int Width, int Height, Color Color, GameScreen Parent)
            : base(Width, Height, PositionX, PositionY, Parent)
        {
            SetupTexture(Texture, Color);
        }

        void SetupTexture(Texture2D Texture, Color Color)
        {
            this.texture = Texture;
            this.color = Color;
        }

        public override void Draw()
        {
            Engine.SpriteBatch.Draw(this.texture, this.Rectangle, this.color);
            base.Draw();
        }
    }
}
